import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		ifhuifu:0,//缓存汇付用来验证是app 还是h5 0h5 1app
		config: {}, // 店铺配置信息
		report_type_list: [],
		orderTab: 0, // 选中的订单tab页
		redirectPage: '',
		uuid: '', //当前客户端
		searchStyle: '',
		searchFixed: false, //搜索框样式
		userShip: {}, //地区信息
		invoice: {}, //发票信息
		shopAddress: {}, // 选择门店地址,

		// 主题风格：purple：紫色系；black：黑色系
		ktheme:'black',
		// 主题背景颜色
		kbackgroundColor : "black",
		kbackgroundColor2:'black',
		// 导航栏背景颜色
		knavgroundColor : "black",
		// 导航栏标题颜色
		knavTitleColor : "#ffffff",
		// 白色
		kwhiteColor : "#ffffff",
		// 黑色
		kblackColor : 'black',
		// 灰色
		kgreyColor : '#F9F9F9',
		// tabbar 背景颜色
		ktabbarBgColor : '#333333',
		// 选项卡默认字体颜色
		ktabNormalColor:"#ffffff",
		// 默认字体颜色
		knormalColor:"#ffffff",
		// 选项卡选中字体颜色
		selectColorSize:"#A3B665",
		// 按钮背景
		buttonBcak : "linear-gradient(135deg, #D1C84D 0%, #3FA87B 100%)",

		// 转售记录tab字体颜色
		kTabnomalColor:'#A3B665',

		ColorSize:"#A3B665", //字体颜色
		ColorSize2:"#A3B665", //字体颜色
		selBcakborder: "linear-gradient(135deg, #D1C84D 0%, #3FA87B 100%)", //选中背景线颜色
		onlyBackgournd:"#9780ff", //单个背景颜色
		QianmenonlyBackgournd:'#F8F6FF', //"rgb(234,225,255,68%)", //浅色背景颜色 单个
		QianmenonlyBackgournd2:"rgb(227, 203, 255)", //浅色背景颜色 单个
		//边框颜色
		borderSty:'1px solid #A3B665',
		//寄售，实名，个人信息背景颜色
		bgColors:'rgba(255, 255, 255, 1)',
		topicAdaptationColors:'#58CE7CFF',//主题适配字体颜色
		paybackground:"black",//支付弹框背景
		grayBackground:'#ffffff',//内容展示背景
		
	},
	// "linear-gradient(to bottom, #ff9799, #ffbcbd, #fffdaf ,#ffffc9)"
	mutations: {
		kbackgroundColor(state, data) {
			state.kbackgroundColor = data
		},
		ifhuifu(state, payload) {
			state.ifhuifu = payload
		},
		config(state, payload) {
			state.config = payload
		},
		report_type_list(state, payload) {
			state.report_type_list = payload
		},
		orderTab(state, tab) {
			state.orderTab = tab
		},
		redirect(state, payload) {
			state.redirectPage = payload.page
		},
		searchStyle(state, style) {
			state.searchStyle = style
		},
		searchFixed(state, payload) {
			state.searchFixed = payload
		},
		userShip(state, userShip) {
			state.userShip = userShip
		},
		invoice(state, invoice) {
			state.invoice = invoice
		},
		changeAddress(state, value) {
			state.shopAddress = value
		},
		// 设置主题
		setTheme(state, data) {
			state.ktheme = data
			if(data == 'purple'){
				state.knavgroundColor='#f3f3f3'//'#ffffff'
				state.kbackgroundColor = "linear-gradient(to bottom,#cca2fc,#f8dcff,#fffdaf,#ffffc9)"
				state.kbackgroundColor2 = "#f3f3f3"
				state.knavTitleColor = "#333333"
				state.ktabbarBgColor = '#ffffff'
				state.buttonBcak=  "linear-gradient(135deg, #6958D5 0%, #AD56D7 100%)" //"linear-gradient(135deg, #978eff 0%, #AD56D7 100%)", //按钮背景  "linear-gradient(135deg, #6958D5 0%, #AD56D7 100%)",
				state.ktabNormalColor = "#333333"
				state.selectColorSize="#673DE7" //选中字体颜色
				state.ColorSize="#BD89F7" //字体颜色
				state.ColorSize2="#cca2fc" //字体颜色
				state.selBcakborder= "linear-gradient(135deg, #5746d5 0%, #9f4fc6 100%)" //选中背景线颜色
				state.onlyBackgournd="#9780ff" //单个背景颜色
				state.QianmenonlyBackgournd='#F8F6FF' //"rgb(234,225,255,68%)", //浅色背景颜色 单个
				state.QianmenonlyBackgournd2="rgb(227, 203, 255)" //浅色背景颜色 单个
				state.borderSty='1px solid #6958D5' //边框颜色  
				state.knormalColor = "#333333"
				state.btColors ='rgba(255, 255, 255, .64)',
				state.topicAdaptationColors='#0072DFFF',
				state.paybackground='#ffffffff',
				state.grayBackground='#ffffff'//内容展示背景
			}else{
				state.knavgroundColor='black'
				state.kbackgroundColor2 = "black"
				state.kbackgroundColor = "black"
				state.knavTitleColor = "#ffffff"
				state.ktabbarBgColor = '#333333'
				state.buttonBcak=  "linear-gradient(135deg, #ECC58B 0%, #FFECC4 100%)" //"linear-gradient(135deg, #978eff 0%, #AD56D7 100%)", //按钮背景  "linear-gradient(135deg, #6958D5 0%, #AD56D7 100%)",
				state.ktabNormalColor = "#ffffff"
				state.selectColorSize="#F5D8A7" //选中字体颜色
				state.ColorSize="#F5D8A7" //字体颜色
				state.ColorSize2="#A3B665" //字体颜色
				state.selBcakborder= "linear-gradient(135deg, #ECC58B 0%, #FFECC4 100%)" //选中背景线颜色
				state.onlyBackgournd="#F5D8A7" //单个背景颜色
				state.QianmenonlyBackgournd='#191919', //浅色背景颜色 单个
				state.QianmenonlyBackgournd2="#F8F6FF" //浅色背景颜色 单个
				state.borderSty='1px solid #FFD38C' //边框颜色
				state.knormalColor = "#ffffff"
				state.btColors ='#ffffff'
				state.topicAdaptationColors='#F5D8A7',
				state.paybackground='#444444',
				state.grayBackground='#ffff53'//内容展示背景
				
			}
			this.knavgroundColor= state.knavgroundColor
			this.ktheme = state.ktheme
			this.knavTitleColor = state.knavTitleColor
			this.backgroundColor = state.kbackgroundColor
			this.ktabNormalColor = state.ktabNormalColor
			this.knormalColor = state.knormalColor
			this.kselectColorSize = state.selectColorSize
			this.kbuttonBgColor = state.buttonBcak
			this.buttonBcak = state.buttonBcak
			this.kborderSty = state.borderSty
			this.btColors = state.btColors
			this.kgrayBackground=state.grayBackground
			this.ktopicAdaptationColors=state.topicAdaptationColors
			this.kbackgroundColor2=state.kbackgroundColor2
		},
	},
	actions: {
		changeTheme( context, boo) {
			context.commit('setTheme',boo)
		},
	},
	getters: {
		theme : state => state.theme,
		shopConfig: state => state.config,
		uuid: state => state.uuid,
	}
})

export default store
